﻿using System;
using System.Web.Mvc;

public static class HtmlHelperExtensions
{
    #region Application Specific

    #region Application

    public static MvcHtmlString ApplicationName(this HtmlHelper helper)
    {
        return MvcHtmlString.Create(Zeenck.Configuration.Zeenck.Info.ApplicationName);
    }

    #endregion Application

    #region Login / Registration

    public static MvcHtmlString LoginTitle(this HtmlHelper helper)
    {
        return MvcHtmlString.Create(Zeenck.Configuration.Zeenck.Info.Login.Title);
    }

    public static MvcHtmlString RegistrationTitle(this HtmlHelper helper)
    {
        return MvcHtmlString.Create(Zeenck.Configuration.Zeenck.Info.Registration.Title);
    }

    public static MvcHtmlString ForgotPasswordText(this HtmlHelper helper)
    {
        return MvcHtmlString.Create(Zeenck.Configuration.Zeenck.Info.ResetPassword.ForgotPasswordText);
    }

    #endregion Login / Registration

    #endregion Application Specific

    #region Generic

    public static MvcHtmlString InputButton(this HtmlHelper helper, String type, String value)
    {
        MvcHtmlString html;

        try
        {
            TagBuilder tagBuilder = new TagBuilder("input");
            tagBuilder.Attributes.Add("type", type);
            tagBuilder.Attributes.Add("value", value);

            html = MvcHtmlString.Create(tagBuilder.ToString());
        }
        catch (Exception)
        {
            TagBuilder tagBuilder = new TagBuilder("input");

            html = MvcHtmlString.Create(tagBuilder.ToString());
        }

        return html;
    }

    public static MvcHtmlString ImageDisplay(this HtmlHelper helper, String source)
    {
        TagBuilder tagBuilder = new TagBuilder("img");
        tagBuilder.Attributes.Add("src", source);
        return MvcHtmlString.Create(tagBuilder.ToString());
    }

    #endregion Generic
}